

const person = "Mike";
const age = 28;

function myTag(strings, personExp, ageExp) {
  const str0 = strings[0]; // "That "
  const str1 = strings[1]; // " is a "
  const str2 = strings[2]; // "."
  const ageStr = ageExp > 99 ? "centenarian" : "youngster";
  return `${str0}${personExp}${str1}${ageStr}${str2}`;
}
const output = myTag`That ${person} is a ${age}.`;
// That Mike is a youngster.
console.log(output);
//模板字符串的前面可以加标签，标签其实是一个函数
//函数的参数 strings personExp ageExp
//用变量作为分隔符，把模板字符串拆开，

let str = '111@222#333';
let strings = str.split(/[@#]/);
console.log(strings)


